#include "utility/data_read_write.h"
#include "teem/nrrd.h"
#include "utility.h"

struct Tensor
{
    float Mxx, Mxy, Mxz, Myx, Myy, Myz, Mzx, Mzy, Mzz;
};

struct Vertex
{
    float x, y, z;
};

void readTensorByNrrd(
    const char* filename,
    std::shared_ptr<char>& pDiagonal,
    std::shared_ptr<char>& pOffDiagonal,
    size_t&uWidth,
    size_t& uHeight,
    size_t& uDepth)
{
    Nrrd *nin= nrrdNew();
    if (nrrdLoad(nin, filename, NULL))
    {
        char* err = biffGetDone(NRRD);
        size_t size = strlen(err) + 1;
        std::unique_ptr<char[]> pstr(new char[size]);
        memcpy(pstr.get(), err, size);
        free(err);
        throw std::exception(pstr.get());
    }

    uWidth = nin->axis[1].size;
    uHeight = nin->axis[2].size;
    uDepth = nin->axis[3].size;

    Tensor* pTensor = (Tensor*)nin->data;
    std::shared_ptr<>

    nrrdNuke(nin);
}